package com.cyan.app.workflow.util;

import android.app.Activity;
import android.content.SharedPreferences;

import com.cyan.app.workflow.AppContext;

/**
 * Created by GivenTang on 2015/8/11.
 * BEAN缓存工具类
 */
public class BeanCacher {

    private static String BEAN_CACHER_FILE_NAME = "bean_cacher_file";

    public static void setCache(String key, String value) {
        SharedPreferences sp = getSharedPref();
        SharedPreferences.Editor editor = sp.edit();
        editor.putString(key, value);
        editor.commit();
    }

    public static String getCache(String key) {
        return getSharedPref().getString(key, "");
    }

    private static boolean checkKey(String key) {
        boolean check = false;
//        check = LiveScoresBean.class.getName().equals(key) || ;
        return check;
    }

    private static SharedPreferences getSharedPref() {
        return AppContext.getInstance().getSharedPreferences(BEAN_CACHER_FILE_NAME, Activity.MODE_PRIVATE);
    }
}
